<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Batch extends Model
{
    const TYPE_NAME = [
        1 => '一面',
        2 => '二面',
        3 => 'HR终面',
    ];

    protected $table = 'batch';

    protected $dateFormat = 'U';

    protected $guarded = [];

    public function firstInterview()
    {
        return $this->hasMany(Talent::class, 'first_batch_id', 'id')
            ->where('interview_status', 2);
    }

    public function secondInterview()
    {
        return $this->hasMany(Talent::class, 'second_batch_id', 'id')
            ->where('interview_status', 6);
    }

    public function hrInterview()
    {
        return $this->hasMany(Talent::class, 'hr_batch_id', 'id')
            ->where('interview_status', 10);
    }
}
